package top.songxs.yygh.service.order.listener;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import top.songxs.mq.consts.MqConst;
import top.songxs.yygh.service.order.service.OrderInfoService;
import top.songxs.yygh.service.order.service.OrderService;

@Component
public class TaskListener {

    @Autowired
    OrderInfoService orderInfoService;

    @Autowired
    OrderService orderService;

    @RabbitListener(
            bindings = {
                    @QueueBinding(
                            value = @Queue(durable = "true" ,name = MqConst.QUEUE_TASK_8),
                            exchange = @Exchange(MqConst.EXCHANGE_DIRECT_TASK),
                            key = (MqConst.ROUTING_TASK_8)
                    )
            }
    )
    public void  ListenerMSM(String message){

        orderService.patientTips(message);
        System.out.println(message);

    }
}
